home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_12 / allison / except.cpp < prev    next >
Encoding:
Text File  |  1994-10-04  |  382 b   |  25 lines

  1. LISTING 4 - Illustrates the semantics of an exception specification
  2.  
  3. // The following is equivalent to:
  4. //     void f() throw(A,B) {}
  5.  
  6. void f()
  7. {
  8.     try
  9.     {
  10.         // Whatever
  11.     }
  12.     catch(A)
  13.     {
  14.         throw;          // rethrow
  15.     }
  16.     catch(B)
  17.     {
  18.         throw;          // rethrow
  19.     }
  20.     catch(...)
  21.     {
  22.         unexpected();
  23.     }
  24. }
  25.